/*
 * exception.h
 *
 *  Created on: 2024年4月24日
 *      Author: pengzc
 */

#ifndef HTTP_EXCEPTION_H_
#define HTTP_EXCEPTION_H_

#include <stdexcept>
#include <curl/curl.h>
#include <base/exception.h>

namespace http {

using baseException = base::Exception;

BASE_IMPLEMENT_EXCEPTION(Exception, baseException); // @suppress("Symbol is not resolved")

} /* namespace http */

#define throwHTTPException(code, fmt, args...) \
  char buffer##__LINE__[256] = {0}; \
  snprintf(buffer##__LINE__, sizeof(buffer##__LINE__), fmt,##args); \
  throw http::Exception(__FILE__, __LINE__, __FUNCTION__, code, buffer##__LINE__);

#endif /* HTTP_EXCEPTION_H_ */
